# Contributor: Alexander Fehr <pizzapunk gmail com>

# Change this to proper kernel release
_kernver=`uname -r`

pkgname=vmware-player-modules
pkgver=2.0.2_59824
pkgrel=4
pkgdesc="Kernel modules for VMware Player"
arch=('i686' 'x86_64')
url="http://www.vmware.com/products/player/"
license=('custom')
depends=('kernel26')
conflicts=('vmware-workstation-modules' 'vmware-server-modules')
install=$pkgname.install
source=(http://bio.artcradle.com/temp/vault/vmware-any-any-update-116.tgz)

build() {
  cd $startdir/src/vmware-any-any-update116/

  # Build and install the kernel modules
  for module in vmmon vmblock vmnet; do
    tar xf $module.tar
    make -C $module-only HEADER_DIR=/lib/modules/$_kernver/build/include VMWARE_VER=VME_V6 || return 1
    install -D -m644 $module-only/$module.ko $startdir/pkg/lib/modules/$_kernver/misc/$module.ko
  done

  # License
  mkdir -p $startdir/pkg/usr/share/licenses/$pkgname
  install -m644 $startdir/src/vmware-player-distrib/doc/{EULA,open_source_licenses.txt} \
    $startdir/pkg/usr/share/licenses/$pkgname

  sed -i -e "s/KERNEL_VERSION='.*'/KERNEL_VERSION='$_kernver'/" $startdir/$pkgname.install
}
